﻿using Decisions.HL7.DataTypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Decisions.HL7.Parser
{
    public class DefaultHL7TypeCreator : ITypeCreator
    {
        public Type GetTypeForName(string name)
        {
            // Default type creator gets types from this, the HL7 Open Source Library from Decisions.
            return this.GetType().Assembly.GetType(name, true);
        }


        public Type[] GetAllSegmentTypes()
        {
            return this.GetType().Assembly.GetTypes().Where(type => type.IsSubclassOf(typeof(AbstractSegment))).ToArray();
        }
    }
}
